package com.reptile.controller;

import com.common.pojo.Result;
import com.reptile.handle.YsPictureHandle;
import com.reptile.service.YsMaterialService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;

@Api(value = "图片控制器")
@RestController
@RequestMapping("pic")
@RequiredArgsConstructor
public class PicController {

    private final YsMaterialService ysMaterialService;

    @Resource
    private YsPictureHandle ysPictureHandle;

    @GetMapping("/clear")
    @ApiOperation(value = "清理重复的图片数据",notes = "清理")
    public Result<?> clear() throws Exception {
        Result result = new Result();
        return result.OK(ysMaterialService.deleteRepeatData());
    }

    @GetMapping("/sg")
    @ApiOperation(value = "测试爬取搜狗图片",notes = "测试爬取搜狗图片")
    public Result<?> sgTest() throws Exception {
        Result result = new Result();
        ysPictureHandle.SouGouPicExecute();
        return result.OK(true);
    }
    @GetMapping("/wal")
    @ApiOperation(value = "测试爬取wal图片",notes = "测试爬取wal图片")
    public Result<?> walTest() throws Exception {
        Result result = new Result();
        ysPictureHandle.WallHavenPicExecute();
        return result.OK(true);
    }

}
